<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <input type="text" name="username" />
  </body>
  <script>
    // 1.body标签
    var body = document.querySelector("body");
    console.log(body);

    // 2.html标签；
    var htmlEle = document.querySelector("html");
    console.log(htmlEle);
    // 简写形式
    // console.log( document.documentElement);

    // 3.head标签
    var headEle = document.querySelector("head");
    console.log(headEle);
    // 简写
    // console.log( document.head);

    // 4.标题  ：获取的是标题的内容，不是标签元素对象；
    var titleEle = document.querySelector("title");
    console.log(titleEle);
    // 简写
    // console.log( document.title);

    // 5.通过名字获取元素；
    var ele = document.getElementsByName("username")[0];
    // console.log(ele);
    ele.value = 123;
  </script>
</html>
